package com.cat.dynamicPlanning02;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/count-numbers-with-unique-digits/description/?envType=problem-list-v2&envId=dynamic-programming
 * @create 2025/9/12 12:56
 * @since JDK17
 */

public class Solution03 {
    public int countNumbersWithUniqueDigits(int n) {
        if (n == 0) {
            return 1;
        }
        int ans = 10, cur = 9;
        for (int i = 2; i <= n; i++) {
            cur = cur * (10 - i + 1) ;
            ans += cur;
        }
        return ans;
    }
}
